<template>
  <div class="content_left_sqfwqk">
    <titleBox text="社区房屋情况"></titleBox>
    <div class="content" v-if="info">
      <div class="lxbox" style="margin: 25px 0 0 0" @click="showXqModal">
        <div style="font-size: 9px">小区总数</div>
        <div style="font-size: 10px; margin-top: 2px">
          <span style="font-size: 14px; margin-right: 2px">{{ info.community_total }}</span>个
        </div>
      </div>
      <div class="lxbox" style="margin: -25px 0 0 -40px">
        <div style="font-size: 9px">楼栋总数</div>
        <div style="font-size: 10px; margin-top: 2px">
          <span style="font-size: 14px; margin-right: 2px">{{ info.occupancy_rate }}</span>栋
        </div>
      </div>
      <div class="lxbox" style="margin: 25px 0 0 -40px">
        <div style="font-size: 9px">入住率</div>
        <div style="font-size: 10px; margin-top: 2px">
          <span style="font-size: 12px; margin-right: 2px">{{info.occupancy_rate}}%</span>
        </div>
      </div>
      <div class="lxbox" style="margin: -25px 0 0 -40px">
        <div style="font-size: 9px">在建小区</div>
        <div style="font-size: 10px; margin-top: 2px">
          <span style="font-size: 14px; margin-right: 2px">{{ info.under_construction }}</span>个
        </div>
      </div>
    </div>
    <xqModal ref="xqModalRef"></xqModal>
  </div>
</template>
<script setup>
  import { onMounted, ref, nextTick } from "vue"
  import $api from "@/utils/request.js"
  import titleBox from "../mConponents/titleBox.vue"
  import xqModal from "../mConponents/modal/xqModal.vue"

  const xqModalRef = ref(null)

  const showXqModal = () => {
    xqModalRef.value.show()
  }

  onMounted(() => {
    getData()
  })
  const info = ref(null)
  const getData = async () => {
    const res = await $api.get("/api/Screen/CommunityBuilding")
    if (res.code === 1) {
      console.log(res)
      info.value = res.data
    }
  }
</script>
<style scoped lang="less">
.content_left_sqfwqk {
  margin-top: 5px;
  .content {
    padding: 10px;
    background-image: url("/img/myimg/lxgzbg.png");
    background-repeat: no-repeat;
    background-size: 300px 120px;
    background-position: 15px 30px;

    background-color: #001a1dcc;
    width: 330px;
    height: 160px;
    border: 1px solid #11afc180;
    border-radius: 5px;
    margin-top: 5px;

    display: flex;
    align-items: center;
    justify-content: center;
    .lxbox {
      flex-direction: column;
      display: flex;
      align-items: center;
      justify-content: center;
      background-image: url("/img/myimg/lx.png");
      background-size: 110px 100px;
      width: 110px;
      height: 100px;
    }
  }
}
</style>
